FROM registry-vpc.cn-hangzhou.aliyuncs.com/epsilon/node:22.13-alpine3.21 AS web

WORKDIR /opt/workflow

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
    apk update && \
    apk add --no-cache git && \
    rm -rf /var/cache/apk/* /tmp/* /var/tmp/* $HOME/.cache

RUN git clone https://gitee.com/git-work/ferry_web.git

WORKDIR ferry_web

RUN npm config set registry https://registry.npmmirror.com && \
    npm install -g pnpm
ENV NODE_OPTIONS=--openssl-legacy-provider
RUN pnpm install
RUN pnpm run build:prod

FROM nginx:1.18.0

COPY --from=builder /opt/ferry_web/web /opt/web
COPY docker/nginx.conf /etc/nginx/nginx.conf
COPY docker/entrypoint.sh /entrypoint.sh

ENV LISTEN_DOMAIN=fdevops.com

#暴露容器8001端口
EXPOSE 8001
ENTRYPOINT [ "/entrypoint.sh" ]
